package cn.hzking.gjmall.app;

import android.content.Context;
import android.os.Handler;

import cn.hzking.gjmall.constant.Constants;

/**
 * Created by 傅令杰 on 2017/3/29
 */

public final class Gjmall {

    public static final Configurator init(Context context) {
        Configurator.getInstance()
                .getLatteConfigs()
                .put(ConfigKeys.APPLICATION_CONTEXT, context.getApplicationContext());
        return Configurator.getInstance();
    }

    public static final Configurator getConfigurator() {
        return Configurator.getInstance();
    }

    public static final  <T> T getConfiguration(Object key) {
        return getConfigurator().getConfiguration(key);
    }

    public static final Context getApplicationContext() {
        return getConfiguration(ConfigKeys.APPLICATION_CONTEXT);
    }

    public static final Handler getHandler() {
        return getConfiguration(ConfigKeys.HANDLER);
    }


    /**
     * 得到正式阿里云域名
     * @return
     */
    public static final String getrelaseOssHost() {
        return getConfiguration(ConfigKeys.OSS_HOST);
    }
    /**
     * 得到测试阿里云域名
     * @return
     */
    public static final String getDeBugOssHost(){
        return getConfiguration(ConfigKeys.DEBUG_OSS_HOST);
    }

    public static final String getOssHost(){
        return Constants.isDebug?getDeBugOssHost():getrelaseOssHost();
    }
    /*
       * 得到正式阿里云域名
     * @return
             */
    public static final String getrelaseApiHost() {
        return getConfiguration(ConfigKeys.API_HOST);
    }
    /**
     * 得到测试阿里云域名
     * @return
     */
    public static final String getDeBugApiHost(){
        return getConfiguration(ConfigKeys.DEBUG_API_HOST);
    }

    public static final String getApiHost(){
        return Constants.isDebug?getDeBugOssHost():getrelaseOssHost();
    }

    /**
     * 得到js交互的别名
     * @return
     */
    public static final String getJsInterface(){
        return getConfiguration(ConfigKeys.JAVASCRIPT_INTERFACE);
    }

    /**
     * 得到appid
     * @return
     */
    public static final String getWxAppId(){
        return getConfiguration(ConfigKeys.WE_CHAT_APP_ID);
    }


}